LAGOS Analysis

Loading in data

First download and then specifically grab the locus (or site lat longs)

# #Lagos download script
LAGOSNE::lagosne_get(dest_folder = LAGOSNE:::lagos_path())
## Warning in LAGOSNE::lagosne_get(dest_folder = LAGOSNE:::lagos_path()): LAGOSNE data for this version already exists on the local machine.
##   Re-download if neccessary using the 'overwrite` argument.'
#Load in lagos
lagos <- lagosne_load()
## Warning in (function (version = NULL, fpath = NA) : LAGOSNE version unspecified,
## loading version: 1.087.3
#Grab the lake centroid info
lake_centers <- lagos$locus

Convert to spatial data

#Look at the column names
#names(lake_centers)

#Look at the structure
#str(lake_centers)

#View the full dataset
#View(lake_centers %>% slice(1:100))

spatial_lakes <- st_as_sf(lake_centers,coords=c('nhd_long','nhd_lat'),
                          crs=4326) %>%
  st_transform(2163)

#Subset for plotting
subset_spatial <- spatial_lakes %>%
  slice(1:100) 

subset_baser <- spatial_lakes[1:100,]

#Dynamic mapviewer
mapview(subset_spatial)

Subset to only Minnesota

states <- us_states()

#Plot all the states to check if they loaded
#mapview(states)
minnesota <- states %>%
  filter(name == 'Minnesota') %>%
  st_transform(2163)

#Subset lakes based on spatial position
minnesota_lakes <- spatial_lakes[minnesota,]
minnesota_lakes$state <- "Minnesota"

#Plotting the first 1000 lakes
minnesota_lakes %>%
  arrange(-lake_area_ha) %>%
    slice(1:1000) %>%
  mapview(.,zcol = 'lake_area_ha')

In-Class work

1) Show a map outline of Iowa and Illinois (similar to Minnesota map upstream)

ia_il <- states[which(states$state_name=='Iowa' | states$state_name=="Illinois"),]

mapview(ia_il)

2) Subset LAGOS data to these sites, how many sites are in Illinois and Iowa combined? How does this compare to Minnesota?

iowa <- states %>%
  filter(name == 'Iowa') %>%
  st_transform(2163)
iowa_lakes <- spatial_lakes[iowa,]
iowa_lakes$state <- "Iowa"

illinois <- states %>%
  filter(name == 'Illinois') %>%
  st_transform(2163)
illinois_lakes <- spatial_lakes[illinois,]
illinois_lakes$state <- "Illinois"

ia_il_lakes <- rbind(iowa_lakes, illinois_lakes)

Answer for 2)

There are 11,822 lakes in Illinois and 4,644 lakes in Iowa, totaling 16,466 lakes between the two states. This is slightly more than half of the number of lakes within Minnesota (56.7% -> 16,466 / 29,038).

3) What is the distribution of lake size in Iowa vs. Minnesota?

  • Here I want to see a histogram plot with lake size on x-axis and frequency on y axis (check out geom_histogram)
ia_mn_lakes <- rbind(iowa_lakes, minnesota_lakes)
ggplot(data=ia_mn_lakes, aes(log(lake_area_ha), color=state)) +
  xlab(" Lake Area (Log Hectare)") +
  ylab("Frequency") +
  ggtitle("Frequency of Lakes in IA and MN by Log Areas") +
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(data=ia_mn_lakes, aes(log(lake_area_ha))) +
  xlab(" Lake Area (Log Hectare)") +
  ylab("Frequency") +
  ggtitle("Frequency of Lakes in IA and MN by Log Areas") +
  facet_wrap(~state) +
  geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

4) Make an interactive plot of lakes in Iowa and Illinois and color them by lake area in hectares

#This will only show the first 5,000 lakes, or roughly the first 1/3 of total lakes.
ia_il_lakes %>%
  arrange(-lake_area_ha) %>%
    slice(1:5000) %>%
  mapview(.,zcol = 'lake_area_ha')

5) What other data sources might we use to understand how reservoirs and natural lakes vary in size in these three states?

Anser for 5)

I would recommend including state departmental GIS data that manages reservoirs and artificial wetland systems. In Colorado, that would be the Department of Water Resources. This data is also available at many county-levels, but just analyzing at the state-level would probably require some data rectification and massaging for them to be output in the same format. This problem would drastically increase at the county level.

Besides the state-level, USGS would also maintain this data similar to their stream gage monitoring system.